package com.king.designpatterns.hybriddesignpattern.hybriddesignpattern.specificationpattern;

/**
 * 姓名相同的规格书
 *
 * @author king
 * @date 2021-06-16 16:33
 */
public class UserByNameEqual extends CompositeSpecification{
    /**
     * 基准姓名
     */
    private String name;

    public UserByNameEqual(String name) {
        this.name = name;
    }

    /**
     * 实现校验方法
     */
    @Override
    public boolean isSatisfiedBy(User user) {
        return name.equals(user.getName());
    }
}
